home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekkan Dennou Club 145
/
Gekkan Dennou Club - 2000.6 Vol. 145 (Japan).7z
/
Gekkan Dennou Club - 2000.6 Vol. 145 (Japan) (Track 1).bin
/
games
/
spassion
/
source.lzh
/
SOURCE
/
FuncEnemy
/
HATCH.C
< prev
next >
Wrap
Text File
|
2000-03-20
|
3KB
|
151 lines
/*
#include <stdio.h>
#include <iocslib.h>
void key_wait( void );
#define BIT(i) (1<<(i))
*/
/* ハッチ */
#include <xsp2lib.h>
#include "../SPASSION.H"
#include "../player.h"
#include "../enemy.h"
#include "../eshot.h"
#include "../effect.h"
#include "../priority.h"
#include "../sound.h"
#include "../entry.h"
#ifndef NULL
#define NULL ((void *) 0)
#endif
#define PALET_MAIN 0x0500
static short MoveEnemyHatch(ENEMY *);
/*static void TiniEnemyHatch(ENEMY *);*/
#define PT_ST 0x0
#define PT_END 0x4
/* 32x16キャラの当たり判定 */
static HIT_XY4 hit_p[]={-16-PLAYER_HIT_X,-8-PLAYER_HIT_Y,16+PLAYER_HIT_X,8+PLAYER_HIT_Y};
static HIT_XY4 hit_o[]={-16-OPTION_HIT_X,-8-OPTION_HIT_Y,16+OPTION_HIT_X,8+OPTION_HIT_Y};
static HIT_XY4 hit_s[]={-16,-8,16,8};
void InitEnemyHatchHit( void )
{
}
static short pt_st[2]={0,5},pt_end[2]={4,9};
void InitEnemyHatch(ENEMY *ene)
{
ene->pt = obj_hatch+pt_st[ene->arg];
ene->info = PALET_MAIN | PRIORITY_ZAKO+1;
ene->vx = -map_vx;
ene->vy = 0;
ene->hit_p[0] = &hit_p[0];ene->hit_p[1]=NULL;
ene->hit_o[0] = &hit_o[0];ene->hit_o[1]=NULL;
ene->hit_s[0] = &hit_s[0];ene->hit_s[1]=NULL;
ene->hp = 10;
ene->work = 0;
ene->no_dead = 0;
ene->func_enemy_move = MoveEnemyHatch;
/* ene->func_enemy_tini = TiniEnemyHatch;*/
/* entry_counter_stop = !0;*/ /* エントリーカウンター停止 */
}
static short MoveEnemyHatch( ENEMY *ene )
{
short Wait( ENEMY *ene, short time );
/* 速度を足して上位ワード(固定整数部)だけ取り出す */
ene->x = ((ene->lx += ene->vx) >> 16);
ene->y = ((ene->ly += ene->vy) >> 16);
switch (ene->state){
case 0:
if( Wait( ene, 20) )ene->state++;
break;
case 1:
ene->pt = obj_hatch+pt_st[ene->arg]+(ene->anim_count++)/4;
if( ene->pt > obj_hatch+pt_end[ene->arg] ){
ene->pt = obj_hatch+pt_end[ene->arg];
ene->anim_count=0;
ene->state++;
}
break;
case 2:
if( Wait( ene, 20) )ene->state++;
break;
case 3:
if( ene->work++ > 12 ){
MakeEnemy(ENEMY_ZAKO05, ene->x, ene->y,ene->arg, ene);
ene->work=0;
if( ene->work2++ > 5 ){ /* 5機出す */
ene->work2=0;
ene->state++;
}
}
break;
case 4:
if( Wait( ene, 20) )ene->state++;
break;
case 5:
ene->pt = obj_hatch+pt_end[ene->arg]-(ene->anim_count++)/4;
if( ene->pt < obj_hatch+pt_st[ene->arg] ){
ene->pt = obj_hatch+pt_st[ene->arg];
ene->anim_count=0;
ene->state++;
}
break;
case 6:
if( Wait( ene, 60) )ene->state=0;
break;
}
/* 画面外に出たら消去 */
if( ENE_X < 0 - 32 )
return (0);
#if 0
if(ENE_X < 128){
ene->lx = 128*65536;
ene->vx = 0;
ene->vy = 0;
}
if( BITSNS(0x04) & BIT(1) ){
while( BITSNS(0x04) & BIT(1) );
entry_counter_stop = 0;
return (0);
}
#endif
/*
printf("x=%d vx=%d\n",ene->x,ene->vx);
key_wait();
*/
/* ダメージを受けた時の処理 */
if(ene->damage){
SetSE(SE_DAMAGE); /* 効果音 */
ene->info = PALET_DAMAGE | PRIORITY_ZAKO+1;
if((ene->hp -= ene->damage) <= 0) {
MakeEffect(EFFECT_EXPL, 0, ene->x-8, ene->y-8);
SetSE(SE_EXPL_HATCH); /* 爆発音 */
ene->player->score += 3;
return (0); /* 消去 */
}
ene->damage = 0;
}else
ene->info = PALET_MAIN | PRIORITY_ZAKO+1;
xobj_set_st(ene);
return(1);
}
/*
static void TiniEnemyHatch(ENEMY * p)
{
}
*/